package org.vectrics.common.html;

import java.lang.Integer;

public class Color {

    public static String makeColor(int redBg, int greenBg, int blueBg) {
        String colorString = "";
        if (redBg > 255)
            redBg = 255;
        if (greenBg > 255)
            greenBg = 255;
        if (blueBg > 255)
            blueBg = 255;
        String redStr = Integer.toHexString(redBg);
        String greenStr = Integer.toHexString(greenBg);
        String blueStr = Integer.toHexString(blueBg);
        
        while (redStr.length() < 2)
            redStr = "0" + redStr;
        while (blueStr.length() < 2)
            blueStr = "0" + blueStr;
        while (greenStr.length() < 2)
            greenStr = "0" + greenStr;
            
        colorString = "#" + redStr + greenStr + blueStr;
        return(colorString);
    }
}
